<template>
    <view class="content">
        <!--顶部搜索按钮区域-->
        <search-top-bar />
        <swiper-list :swiperList="swiperDic1" key="1" />
        <image
            class="main1"
            src="/static/images/main-1.jpg"
            mode="widthFix"
            fade-show
            lazy-load
        />
        <swiper-list2 :swiperList="swiperDic2" key="2" />
        <!--作品欣赏-->
        <image
            @click="goNext('作品欣赏')"
            class="main1"
            src="/static/images/main-2.jpg"
            mode="widthFix"
            fade-show
            lazy-load
        />
        <!--新闻活动-->
        <image
            @click="goNext('新闻活动')"
            class="main1"
            src="/static/images/main-3.jpg"
            mode="widthFix"
            fade-show
            lazy-load
        />
        <swiper-list :swiperList="swiperDic3" key="3" />
    </view>
</template>

<script setup>
//import {useTopBarShow} from "@/utils/composables/scroll.js";
import useShare from "@/utils/composables/useShare";
import { getSwiperApi } from "@/api/index.js";
import searchTopBar from "./components/searchTopBar.vue";
import swiperList from "./components/swiperList.vue";
import swiperList2 from "./components/swiperList2.vue";
const {onShareAppMessage,onShareTimeline}=useShare()
//const {topBarShow}= useTopBarShow();
const swiperDic1 = ref([]);
const swiperDic2 = ref([]);
const swiperDic3 = ref([]);
// const displayItems1=ref(1);
//  const displayItems2=ref(1);
//  const displayItems3=ref(1);
const goNext = (label) => {
    switch (label) {
        case "作品欣赏":
            uni.navigateTo({
                url: "../subPackageA/pictureCards/index?type=H1",
            });
            break;
        case "新闻活动":
            uni.navigateTo({
                url: "../subPackageA/pictureCards/index?type=H2",
            });
            break;
        default:
            break;
    }
};
const getSwiperList = () => {
    getSwiperApi({page:'H'}).then((res) => {
        console.log("获取轮播图列表lists---",res);
		const list=res.data?.length?res.data:[];
		swiperDic1.value = list.filter(v=>v.position=='TOP')?.[0]?.data||[];
		swiperDic2.value = list.filter(v=>v.position=='MIDDLE')?.[0]?.data||[];
		swiperDic3.value = list.filter(v=>v.position=='BOTTOM')?.[0]?.data||[];
    });
};
onPullDownRefresh(() => {
    getSwiperList();
    setTimeout(() => {
        uni.stopPullDownRefresh();
    }, 3000);
});
onLoad((options) => {
    //console.log(topBarShow.vue,'----topBarShow');
    // wx.login({
    //   success (res) {
    //     if (res.code) {
    // 		console.log(res.code,'----res.code')
    //       //发起网络请求
    //       // wx.request({
    //       //   url: 'https://example.com/onLogin',
    //       //   data: {
    //       //     code: res.code
    //       //   }
    //       // })
    //     } else {
    //       console.log('登录失败！' + res.errMsg)
    //     }
    //   }
    // })
    console.log("onLoad--6666666-----");
    getSwiperList();
});
</script>

<style lang="scss">
.content {
    box-sizing: border-box;
    background-color: #000;
    //background: #f7f8fa;
    .main1 {
        display: block;
        margin: 0;
        width: 100%;
        //aspect-ratio:16/9;
    }
}
</style>
